<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace app\adminapi\validate\setting;

use think\Validate;

class SystemMenuValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'pid|父节点' => 'require',
        'name|菜单名' => 'require',
        'type|菜单类型' => 'require|in:dir,menu,api,btn,iframe,link',
        'path|路由' => 'require',
        'ids|菜单ids' => 'require|array',
        'draggingNode|排序对象' => 'require',
        'dropNode|释放对象' => 'require',
        'dropType|释放对象未知' => 'require|in:before,after,inner'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'type.in' => '菜单类型必须是dir,menu,api,btn,iframe,link中的一个',
    ];

    /**
     * 验证场景定义
     * @var array
     */
    protected $scene = [
        'editSystemMenu' => ['pid', 'name', 'type', 'path'],
        'delSystemMenu' => ['ids'],
        'sortSystemMenu' => ['draggingNode', 'dropNode', 'dropType']
    ];
}
